package com.lightjet.macross.base.upms.controller;

import com.lightjet.macross.base.upms.domain.AppClient;
import com.lightjet.macross.base.upms.dto.GatewayRouteDefinitionDTO;
import com.lightjet.macross.base.upms.service.GateWayClientService;
import com.lightjet.macross.common.dto.ResponseDTO;
import com.lightjet.macross.common.util.RespUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : lijia
 * @version : 1.0 2020-05-15 11:04
 * description : 微服务控制管理控制器类
 */


@RestController
@RequestMapping("/api/admin")
@Scope("request")
@Log
@RefreshScope
public class AdminController {

    @Resource
    private GateWayClientService gateWayClientService;

    @PostMapping(value = "/route")
    public ResponseDTO<String> RouteAdd(@RequestBody GatewayRouteDefinitionDTO gwdefinition) {

        return gateWayClientService.RouteAdd(gwdefinition);

    }

    @PutMapping(value = "/route")
    public ResponseDTO<String> RouteUpdate(@RequestBody GatewayRouteDefinitionDTO gwdefinition) {

        return gateWayClientService.RouteUpdate(gwdefinition);

    }

    @DeleteMapping(value = "/route/{id}")
    public ResponseDTO<String> RouteDelete(@PathVariable("id") String id) {

        return gateWayClientService.RouteDelte(id);

    }
}
